
<!DOCTYPE HTML>
<html>
<head>
    <title>枣阳市第二人民医院信息管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../assets/css/dpl-min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/css/bui-min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/css/main-min.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../assets/js/jquery-1.6.js"></script>
<script type="text/javascript" src="../assets/js/bui.js"></script>
<script type="text/javascript" src="../assets/js/common/main-min.js"></script>
<script type="text/javascript" src="../assets/js/config-min.js"></script>
<body>

<div class="content">
    <div class="dl-main-nav">
        <div class="dl-inform"><div class="dl-inform-title"><s class="dl-inform-icon dl-up"></s></div></div>
        <ul id="J_Nav"  class="nav-list ks-clear" style="float:left">
            <!--<li class="nav-item dl-selected"><div class="nav-item-inner nav-home">信息采编系统</div></li>-->
            <li style=" color:#fff; font-size:20px; margin-top:10px; margin-left:20px;">山东省第二人民医院管理平台</li>
        </ul>
        <div  style="float:right; color:#fff;">欢迎您，<span class="dl-log-user" name="trueName"></span><a onclick="logout()" title="退出系统" class="dl-log-quit">[退出]</a></div>
    </div>

    <ul id="J_NavContent" class="dl-tab-conten">
    </ul>
</div>

<script>

    String.prototype.GetValue= function(para) {
        let reg = new RegExp("(^|&)"+ para +"=([^&]*)(&|$)");
        let r = this.substr(this.indexOf("\?")+1).match(reg);
        if (r!=null) return unescape(r[2]); return null;
    }

    $(function () {

        let url = document.location.toString(); //获取URL
        let loginName=url.GetValue("loginName");
        $(".dl-log-user").html(loginName);

        //获取登录账号拥有的菜单
        $.ajax({
            type : "GET",
            url : "/sysUser/loginName",
            data : "loginName="+loginName,
            dataType:"json",
            success:function(vo){
                let sysUser = vo.obj;
                let sysUserId=sysUser.id;
                let trueName = sysUser.trueName;
                let menuList = sysUser.role.menuList;
                $("span[name=trueName]").html(trueName);
                let message=[];
                for (let i =0;i<menuList.length;i++){
                    if ("密码管理"==menuList[i].menuName){
                        url=menuList[i].url+"?sysUserId="+sysUserId
                    }else {
                        url=menuList[i].url
                    }
                    message.push({id:menuList[i].id,text:menuList[i].menuName,href:url})
                }
                BUI.use('common/main',function(){
                    var config = [
                        {id:'1',menu:[

                                {text:'快速通道',items:message
                                }
                            ]}
                    ];
                    new PageUtil.MainPage({
                        modulesConfig : config
                    });
                });


                setTimeout(()=>{
                    // iframe设置选中的页面
                    $("iframe").attr("src",$('.bui-menu-item-selected>a').attr('href'))
                },10)

            }
        });
    });

    function logout() {
       $.ajax({
            type : "GET",
            url : "/system/logout",
            data : "",
            dataType:"json",
            success:function(vo){
                if(vo.code==200) {
                    window.location.href = "/page/login.html";
                }
            }

        });
    }

</script>
</body>
</html>